package com.jeesite.modules.isys.keys.service.impl;

import com.jeesite.modules.isys.keys.entity.Abnormal;
import com.jeesite.modules.isys.keys.mapper.AbnormalMapper;
import com.jeesite.modules.isys.keys.service.IAbnormalService;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author XYMTOP
 * @since 2023-11-12
 */
@Service
public class AbnormalServiceImpl extends ServiceImpl<AbnormalMapper, Abnormal> implements IAbnormalService {
    @Autowired
    private AbnormalMapper abnormalMapper;

    /**
     * 根据异常ID获取异常信息
     * @param abnormalId 异常ID
     * @return 异常实体对象
     */
    @Override
    public Abnormal getAbnormalById(String abnormalId) {
        return abnormalMapper.selectAbnormalById(abnormalId);
    }

    /**
     * 更新异常审核状态
     * @param abnormalId 异常ID
     * @param auditStatus 审核状态
     */
    @Override
    public void updateAbnormalAuditStatus(String abnormalId, Integer auditStatus) {
        abnormalMapper.updateAbnormalAuditStatus(abnormalId, auditStatus);
    }

    /**
     * 获取待审核的异常列表
     * @return 待审核异常列表
     */
    @Override
    public List<Abnormal> getPendingAuditAbnormals() {
        return abnormalMapper.selectPendingAuditAbnormals();
    }

    /**
     * 获取已审核的异常列表
     * @return 已审核异常列表
     */
    @Override
    public List<Abnormal> getReviewedAbnormals() {
        return abnormalMapper.selectReviewedAbnormals();
    }
}
